const app = getApp()
const api = require('../../api/api')
const util = require('../../utils/js/util')
Page({
  data: {
    id: '',
    info: null,
    config: null,
    safeToBottom: util.getSafeToBottom(),
  },
  async onLoad(options) {
    this.setData({ id: options.id })
    await this.getconfig()
    this.getinfo()
  },
  async getinfo() {
    const res = await api.getWorkerInfo({ userId: this.data.id })
    res.salary = this.data.config.salary[res.salary]
    res.skill = res.skill.split(',').map(v => this.data.config.skill[v]).join('、')
    res.industry = res.industry.split(',').map(v => this.data.config.industry[v]).join('、')
    res.post = res.post.split(',').map(v => this.data.config.post[v]).join('、')
    res.workarea = res.workarea.split(',').map(v => this.data.config.workarea[v]).join('、')
    this.setData({ info: res })
    console.log(res);
  },
  async getconfig() {
    const res = await api.getConfigList()
    this.setData({
      config: res
    })
  },
  onReachBottom() {

  },
  onShareAppMessage(e) {
    // return {
    //   title: this.data.sharetitle,
    //   path: `/pages/index/index?id=${this.data.userInfo.id}`,
    //   imageUrl: this.data.shareimg
    // }
  },
});